package com.dynabook.ems.disruptor.Excel;


import com.dynabook.ems.model.dto.EmsDataDTO;
import com.dynabook.ems.service.EmsMainEngineService;
import com.lmax.disruptor.WorkHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Component
public class EmsEventHandler implements WorkHandler<EmsDataEvent> {

    @Resource
    @Lazy
    private EmsMainEngineService emsMainEngineService;

    @Override
    public void onEvent(EmsDataEvent event) throws Exception {
        List<EmsDataDTO> params = event.getParams();
        log.info("EmsEventHandler:{}", params);
        Boolean result = emsMainEngineService.updateEmsMainEngine(params);
//        log.info("更新状态:{}", result);
    }
}